package com.ruoyi.commodity.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.commodity.domain.CommodityOrderSub;
import com.ruoyi.commodity.mapper.CommodityOrderSubMapper;
import com.ruoyi.commodity.service.ICommodityOrderSubService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 商品订单子单Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-14
 */
@Service
public class CommodityOrderSubServiceImpl extends ServiceImpl<CommodityOrderSubMapper,CommodityOrderSub> implements ICommodityOrderSubService
{
    @Resource
    private CommodityOrderSubMapper commodityOrderSubMapper;

    /**
     * 查询商品订单子单
     *
     * @param id 商品订单子单主键
     * @return 商品订单子单
     */
    @Override
    public CommodityOrderSub selectCommodityOrderSubById(String id)
    {
        return commodityOrderSubMapper.selectCommodityOrderSubById(id);
    }

    /**
     * 查询商品订单子单列表
     *
     * @param commodityOrderSub 商品订单子单
     * @return 商品订单子单
     */
    @Override
    public List<CommodityOrderSub> selectCommodityOrderSubList(CommodityOrderSub commodityOrderSub)
    {
        return commodityOrderSubMapper.selectCommodityOrderSubList(commodityOrderSub);
    }

    /**
     * 新增商品订单子单
     *
     * @param commodityOrderSub 商品订单子单
     * @return 结果
     */
    @Override
    public int insertCommodityOrderSub(CommodityOrderSub commodityOrderSub)
    {
        commodityOrderSub.setCreateTime(DateUtils.getNowDate());
        return commodityOrderSubMapper.insertCommodityOrderSub(commodityOrderSub);
    }

    /**
     * 修改商品订单子单
     *
     * @param commodityOrderSub 商品订单子单
     * @return 结果
     */
    @Override
    public int updateCommodityOrderSub(CommodityOrderSub commodityOrderSub)
    {
        return commodityOrderSubMapper.updateCommodityOrderSub(commodityOrderSub);
    }

    /**
     * 批量删除商品订单子单
     *
     * @param ids 需要删除的商品订单子单主键
     * @return 结果
     */
    @Override
    public int deleteCommodityOrderSubByIds(String[] ids)
    {
        return commodityOrderSubMapper.deleteCommodityOrderSubByIds(ids);
    }

    /**
     * 删除商品订单子单信息
     *
     * @param id 商品订单子单主键
     * @return 结果
     */
    @Override
    public int deleteCommodityOrderSubById(String id)
    {
        return commodityOrderSubMapper.deleteCommodityOrderSubById(id);
    }
}
